var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]);
    })(t, e);
}, function(t, e) {
    function r() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (r.prototype = e.prototype, 
    new r());
}), a = this && this.__decorate || function(t, e, r, o) {
    var n, a = arguments.length, c = a < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, r) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) c = Reflect.decorate(t, e, r, o); else for (var i = t.length - 1; 0 <= i; i--) (n = t[i]) && (c = (a < 3 ? n(c) : 3 < a ? n(e, r, c) : n(e, r)) || c);
    return 3 < a && c && Object.defineProperty(e, r, c), c;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameData"), s = e("LoadManager"), c = e("Global"), l = cc._decorator, d = l.ccclass, u = l.property, p = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.label = null, t.sprite = null, t.rank = 0, t.price = 0, t;
    }
    return i(t, e), t.prototype.start = function() {}, t.prototype.refresh = function() {
        this.rank = this.getRank(), this.price = c.G.getPrice(this.rank), this.label.string = GA.formatNumber(this.price), 
        s.default.getInstance().loadSpriteFrame({
            url: "image/arm/" + c.G.getIdxByRank(this.rank),
            sprite: this.sprite
        });
    }, t.prototype.getRank = function() {
        for (var t = 0, e = null, o = Math.max(0, r.GD.topRank - 5); o < c.G.gunModelList.length; o++) {
            var n = c.G.getPrice(o) / Math.pow(2, o);
            (!e || n < e) && (e = n, t = o);
        }
        return t;
    }, a([ u(cc.Label) ], t.prototype, "label", void 0), a([ u(cc.Sprite) ], t.prototype, "sprite", void 0), 
    a([ d ], t);
}(cc.Component);

n.default = p;